package training.sample.app.web.converters;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import training.sample.app.domain.Client;
import training.sample.app.service.ClientService;
 
@Component
public class StringToClientConverter implements Converter<String, Client> {
 
    @Autowired
	private ClientService clientService;
     
    @Override
    public Client convert(String clientId) {
        return clientService.getClientByID(new Long(clientId));
    }
 
}